package com.gitee.wsl.lifecycle.context

import com.gitee.wsl.data.state.statekeeper.StateKeeper
import com.gitee.wsl.lifecycle.Lifecycle


/**
 * Represents a factory that creates new instances of component contexts of type [T].
 * Used by various navigation models that require creating child component contexts.
 */
fun interface ComponentContextFactory<out T : Any> {

    /**
     * Creates a new instance of component context of type [T], not attached to any
     * parent component context.
     */
    operator fun invoke(
        lifecycle: Lifecycle,
        stateKeeper: StateKeeper,
    ): T
}